import {  getCache, getCacheLoca,  setCache, setCacheLoca,clearCache,comCache,setCookie,getCookie,delCookie } from './plugins/index'
import './App.css'
import { useEffect } from 'react'

function App() {
  useEffect(() => {
    setCache('test1', 1, 2, 'ss')
    setCache('test11', 2, 20,'ss')
    setCache('test2', 456,1)
    setCache('test3', 789,2)
    setCacheLoca('test4', '123456')
    setCacheLoca('test5', 'abcdefg')
    setCacheLoca('test6', '1234567890')

    setInterval(() => {
        console.log(getCache('test1'))
        console.log(getCache('test11'))
        console.log(getCache('test2'))
        console.log(getCacheLoca('test4'))
        console.log(getCacheLoca('test5'))
        console.log(getCacheLoca('test6'))
        console.log(comCache('test11')+'s')
        console.log(comCache('test2')+'s')
        console.log(comCache('test3')+'s')
    }, 1000)
    setCookie('name1', 'value1', 10)
    setCookie('name2', 'value2', 20)

    console.log(getCookie('name1')) 
    console.log(getCookie('name2')) 
    setTimeout(() => {
       setCache('test3', 'x',2)
      delCookie('name1')
    },5000)
  }, [])

  return (
    <>
      <h1>Vite + React</h1>
    </>
  )
}

export default App
